home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / drdobbs / 1987 / 06 / bbs.l4 < prev    next >
Text File  |  1987-05-05  |  1KB  |  57 lines

  1. Listing Four
  2.  
  3. readmsg
  4.  
  5.  
  6.  
  7. 1    FIRST=/u/bbs/.first
  8. 2    LAST=/u/bbs/.last
  9. 3    MSG=/u/bbs/msg
  10. 4    echo 'who am i | cut -f1 -d" " ' ' date | cut -c1-16' "readmsg" >>/u/bbs/log.file
  11. 5    echo
  12.  
  13.     # display the number of the first and last messages available
  14.  
  15. 6    echo "Messages available:"
  16. 7    cat $FIRST
  17. 8    echo "through"
  18. 9    cat $LAST
  19. 10    echo
  20.  
  21.     # accept the number of the first message to be displayed
  22.  
  23. 11    echo "Message number to read ('q' to quit): \c"
  24. 12    read message
  25.  
  26.     # loop until the user wants to quit
  27.  
  28. 13    while [ "$message" != q ]
  29. 14    do
  30. 15        echo
  31.  
  32.     # verify that the message number entered actually exists
  33.  
  34. 16        if [ -f $MSG/$message ]
  35. 17        then
  36.  
  37.     # display the message
  38.  
  39. 18            cat $MSG/$message
  40. 19        elif [ "$message" != q ]
  41. 20        then
  42.  
  43.     # the entered message number doesn't exist
  44.  
  45. 21            echo "Sorry.  That message doesn't exist."
  46. 22        fi
  47. 23        echo
  48.  
  49.     # accept the next message number to read
  50.  
  51. 24        echo "Message number to read: ('q' to quit): \c"
  52. 25        read message
  53. 26    done
  54. 27    echo
  55.  
  56.  
  57.